-- phpMyAdmin SQL Dump
-- version 3.4.3.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 16, 2013 at 12:30 PM
-- Server version: 5.5.15
-- PHP Version: 5.3.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `bids`
--

CREATE TABLE IF NOT EXISTS `bids` (
  `Bid_Id` int(11) NOT NULL AUTO_INCREMENT,
  `User_Id` int(11) NOT NULL,
  `Obj_Id` int(11) NOT NULL,
  `Price` int(11) NOT NULL,
  PRIMARY KEY (`Bid_Id`),
  KEY `User_Id` (`User_Id`,`Obj_Id`),
  KEY `Obj_Id` (`Obj_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE IF NOT EXISTS `category` (
  `Cat_Id` int(11) NOT NULL AUTO_INCREMENT,
  `CategoryName` varchar(50) NOT NULL,
  PRIMARY KEY (`Cat_Id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`Cat_Id`, `CategoryName`) VALUES
(1, 'Kläder & Accessoarer'),
(2, 'Hemelektronik');

-- --------------------------------------------------------

--
-- Table structure for table `images`
--

CREATE TABLE IF NOT EXISTS `images` (
  `Image_Id` int(11) NOT NULL AUTO_INCREMENT,
  `FileName` varchar(100) NOT NULL,
  `MimeType` enum('image/png','image/jpeg','image/gif','') NOT NULL,
  `Caption` varchar(50) DEFAULT NULL,
  `Image` blob NOT NULL,
  `Width` int(4) NOT NULL,
  `Height` int(4) NOT NULL,
  PRIMARY KEY (`Image_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `object`
--

CREATE TABLE IF NOT EXISTS `object` (
  `Obj_Id` int(11) NOT NULL AUTO_INCREMENT,
  `User_Id` int(11) NOT NULL,
  `Cat_Id` int(11) NOT NULL,
  `ObjTitle` varchar(60) NOT NULL,
  `ObjDesc` varchar(5000) NOT NULL,
  `ObjPrice` int(11) NOT NULL,
  `ObjTime` datetime NOT NULL,
  PRIMARY KEY (`Obj_Id`),
  KEY `User_Id` (`User_Id`),
  KEY `Cat_Id` (`Cat_Id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `object`
--

INSERT INTO `object` (`Obj_Id`, `User_Id`, `Cat_Id`, `ObjTitle`, `ObjDesc`, `ObjPrice`, `ObjTime`) VALUES
(1, 1, 2, 'Fin TV 10"', 'Grym TV', 50, '2013-04-16 14:00:00');

-- --------------------------------------------------------

--
-- Table structure for table `objimages`
--

CREATE TABLE IF NOT EXISTS `objimages` (
  `ObjImage_Id` int(11) NOT NULL AUTO_INCREMENT,
  `Obj_Id` int(11) NOT NULL,
  `Image_Id` int(11) NOT NULL,
  PRIMARY KEY (`ObjImage_Id`),
  KEY `Obj_Id` (`Obj_Id`),
  KEY `Image_Id` (`Image_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `User_Id` int(11) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(25) COLLATE utf8_swedish_ci NOT NULL,
  `PassWord` varchar(50) COLLATE utf8_swedish_ci NOT NULL,
  `FirstName` varchar(25) COLLATE utf8_swedish_ci NOT NULL,
  `LastName` varchar(50) COLLATE utf8_swedish_ci NOT NULL,
  `SocNr` varchar(10) COLLATE utf8_swedish_ci NOT NULL,
  `Address` varchar(100) COLLATE utf8_swedish_ci NOT NULL,
  `Address 2` varchar(100) COLLATE utf8_swedish_ci DEFAULT NULL,
  `Town` varchar(50) COLLATE utf8_swedish_ci NOT NULL,
  `ZipCode` int(5) NOT NULL,
  `PhoneNumber` varchar(10) COLLATE utf8_swedish_ci NOT NULL,
  `eMail` varchar(100) COLLATE utf8_swedish_ci NOT NULL,
  PRIMARY KEY (`User_Id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci AUTO_INCREMENT=3 ;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`User_Id`, `UserName`, `PassWord`, `FirstName`, `LastName`, `SocNr`, `Address`, `Address 2`, `Town`, `ZipCode`, `PhoneNumber`, `eMail`) VALUES
(1, 'EdinSkeja', 'hejpadig', 'Edin', 'Skeja', '9107010697', 'Skräddaretorpsvägen 10', NULL, 'Kalmar', 39353, '0767816161', 'edin.skeja@me.com'),
(2, 'wibjer', 'd8578edf8458ce06fbc5bb76a58c5ca4', 'dsgsfdg', 'dfgsdfgd', 'dfgdsgf', 'dfgdg', 'dgdg', 'dsgfg', 255, 'dfgsdfg', 'dgdgfd');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `bids`
--
ALTER TABLE `bids`
  ADD CONSTRAINT `bids_ibfk_2` FOREIGN KEY (`Obj_Id`) REFERENCES `object` (`Obj_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `bids_ibfk_1` FOREIGN KEY (`User_Id`) REFERENCES `users` (`User_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `object`
--
ALTER TABLE `object`
  ADD CONSTRAINT `object_ibfk_2` FOREIGN KEY (`Cat_Id`) REFERENCES `category` (`Cat_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `object_ibfk_1` FOREIGN KEY (`User_Id`) REFERENCES `users` (`User_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `objimages`
--
ALTER TABLE `objimages`
  ADD CONSTRAINT `objimages_ibfk_2` FOREIGN KEY (`Image_Id`) REFERENCES `images` (`Image_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `objimages_ibfk_1` FOREIGN KEY (`Obj_Id`) REFERENCES `object` (`Obj_Id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
